calendar: value of day property is shifted by 1
authorCarlos Garcia Campos <cgarcia@igalia.com>
Fri, 7 May 2021 09:10:36 +0000 (11:10 +0200)
committerCarlos Garcia Campos <cgarcia@igalia.com>
Fri, 7 May 2021 09:10:36 +0000 (11:10 +0200)
The day is a number between 1 and 31 and that's what we get from
GDateTime.

gtk/gtkcalendar.c

index ad7cbb15415e6022dd17941a3e22fca0ef69eea7..cda27021b87dcb7f78cfb0de51bd4c9a672c14c0 100644 (file)
@@ -1025,7 +1025,7 @@ gtk_calendar_set_property (GObject      *object,
     case PROP_DAY:
       date = g_date_time_new_local (g_date_time_get_year (calendar->date),
                                     g_date_time_get_month (calendar->date),
-                                    g_value_get_int (value) + 1,
+                                    g_value_get_int (value),
                                     0, 0, 0);
       if (date)
         {
@@ -1065,7 +1065,7 @@ gtk_calendar_get_property (GObject      *object,
       g_value_set_int (value, g_date_time_get_month (calendar->date) - 1);
       break;
     case PROP_DAY:
-      g_value_set_int (value, g_date_time_get_day_of_month (calendar->date) - 1);
+      g_value_set_int (value, g_date_time_get_day_of_month (calendar->date));
       break;
     case PROP_SHOW_HEADING:
       g_value_set_boolean (value, gtk_calendar_get_show_heading (calendar));